import { useEffect, useState } from 'react';
import { Card, Statistic, Row, Col, Spin, Typography, Table } from 'antd';
import {
    // 使用明确存在的图标，或从icons库中导入
    ShopOutlined,    // 替代 SchoolOutlined
    TeamOutlined,
    UserOutlined,
    BuildOutlined    // 替代 BuildingOutlined
} from '@ant-design/icons';
// 或者直接从完整图标集导入（如果版本支持）

import { getDashboardStats, getRecentSchools } from '../../api/dashboard';

const { Title, Text } = Typography;

const Dashboard = () => {
    const [stats, setStats] = useState({
        manufacturerCount: 0,
        schoolCount: 0,
        gradeCount: 0,
        studentCount: 0,
    });
    const [recentSchools, setRecentSchools] = useState([]);
    const [loading, setLoading] = useState(true);

    // 获取统计数据
    // useEffect(() => {
    //     const fetchData = async () => {
    //         try {
    //             setLoading(true);
    //             // 并行请求数据
    //             const [statsData, schoolsData] = await Promise.all([
    //                 getDashboardStats(),
    //                 getRecentSchools()
    //             ]);
    //             setStats(statsData.data);
    //             setRecentSchools(schoolsData.data);
    //         } catch (error) {
    //             console.error('获取首页数据失败', error);
    //         } finally {
    //             setLoading(false);
    //         }
    //     };

    //     fetchData();
    // }, []);

    // 最近添加的学校表格列
    const schoolColumns = [
        { title: '学校名称', dataIndex: 'name', key: 'name' },
        { title: '所属厂商', dataIndex: 'manufacturer_name', key: 'manufacturer_name' },
        { title: '学制', dataIndex: 'education_years', key: 'education_years', render: (years: number) => `${years}年制` },
        { title: '创建时间', dataIndex: 'created_at', key: 'created_at' },
    ];

    return (
        <div>
            <Title level={3}>系统概览</Title>

            <Spin spinning={loading}>
                <div>ssssssssssss</div>
            </Spin>
        </div>
    );
};

export default Dashboard;
